import React from 'react';
import {connect} from 'react-redux';
import {Redirect} from 'react-router-dom';

class Coupon extends React.Component {
  render() {
    if(this.props.userName) {
      return (
        <div>这是购书券页面</div>
      );
    }
    else {
      return (<Redirect  to='/login?redirect=/coupon' />);
    }
  }
};

export default connect(
  state => {
    return {
      userName:state.user.userName
    }
  },
  null
)(Coupon);
